cc=g++
bin=http_server
src=main.cc
cgi=cgi_target
LD_FLAGS=-std=c++11 -lpthread

all: $(bin) $(cgi)

$(bin): $(src)
	$(cc) -o $@ $^ $(LD_FLAGS)

$(cgi):
	@cd cgi/ && make


.PHONY: clean
clean:
	rm -rf $(bin) public/
	@cd cgi/ && make clean


.PHONY: public
public:
	mkdir  public/
	cp -rf wwwroot/      public/
	cp -rf http_server   public/
	@cd cgi/ && make public